package labs.main;

import static labs.utilities.PrintUtilities.printInfo;
import static labs.utilities.PrintUtilities.printSeparator;

/**
 * Name: Ahmed Mahmoud Mohammed ID: 16-8021
 * 
 * Name: Moustafa Magdy ID: 13-4802
 * 
 */
public class Main {

	public static void runLab2() {
		String[] fileNames = { "lab-3\\InputOutputFiles\\XSCode.java",
				"lab-3\\InputOutputFiles\\SCode.java",
				"lab-3\\InputOutputFiles\\MCode.java",
				"lab-3\\InputOutputFiles\\LCode.java",
				"lab-3\\InputOutputFiles\\XLCode.java" };
		printInfo("Current Path: %s", System.getProperty("user.dir"));
		for (int i = 0; i < fileNames.length; i++) {
			labs.second.Parser parser = new labs.second.Parser(fileNames[i]);
			parser.start();
			printSeparator();
		}
	}

	public static void runLab3() {
		String[] fileNames = { "lab-3\\InputOutputFiles\\XSCode.java",
				"lab-3\\InputOutputFiles\\SCode.java",
				"lab-3\\InputOutputFiles\\MCode.java",
				"lab-3\\InputOutputFiles\\LCode.java",
				"lab-3\\InputOutputFiles\\XLCode.java" };
		printInfo("Current Path: %s", System.getProperty("user.dir"));
		for (int i = 0; i < fileNames.length; i++) {
			labs.third.Parser parser = new labs.third.Parser(fileNames[i]);
			parser.start();
			printSeparator();
		}

	}

	public static void runLab4() {
		String fileName = "lab-4\\InputOutputFiles\\Code%s1.java";
		int numberOfFiles = 6;
		String currentFileName = "";
		// labs.fourth.SyntacticAnalyzer analyzer;
		for (int i = 1; i <= numberOfFiles; i++) {
			String zeroes = "";
			for (int j = 0; j < i; j++) {
				zeroes += "0";
			}
			currentFileName = String.format(fileName, zeroes);
			labs.fourth.SyntacticAnalyzer analyzer = new labs.fourth.SyntacticAnalyzer(
					currentFileName);
			System.out.println("Correct syntax: " + analyzer.start());
			System.out.println("Last Token: " + analyzer.getErrorMessage());
			printSeparator();
		}
	}

	public static void main(String[] args) {
		runLab4();
	}
}
